﻿<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <style>
        .el-dropdown-link {
            cursor: pointer;
            color: #409EFF;
        }
        .el-icon-arrow-down {
            font-size: 12px;
        }
    </style>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>人群分类
            <!-- <small>检查项管理</small>-->
        </h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>健康干预</el-breadcrumb-item>
            <el-breadcrumb-item>人群分类</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <div class="filter-container">
                <el-input placeholder="姓名/档案号/病情" v-model="pagination.queryString" style="width: 200px;"
                          class="filter-item"></el-input>
                <el-button @click="findillness()" class="dalfBut">查询</el-button>
            </div>
            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
                <el-table-column type="fileNumber" align="center" label="档案号"></el-table-column>
                <el-table-column prop="membername" label="姓名" align="center"></el-table-column>
                <el-table-column prop="sex" label="性别" align="center"></el-table-column>
                <el-table-column prop="remark" label="状态" align="center"></el-table-column>

                <el-table-column prop="name" label="人群分类" align="center">
                    <!--  <el-dropdown @command="handleCommand">
                      <span class="el-dropdown-link">人群分类<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>
                      </span>
                          <el-dropdown-menu slot="dropdown">
                              <el-dropdown-item command="艾滋">艾滋</el-dropdown-item>
                              <el-dropdown-item command="癌症">癌症</el-dropdown-item>
                              <el-dropdown-item command="感冒">感冒</el-dropdown-item>
                              <el-dropdown-item command="心理不正常">心理不正常</el-dropdown-item>
                          </el-dropdown-menu>
                      </el-dropdown>-->
                </el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">确定分类</el-button>
                        <el-button size="mini" type="danger" @click="handleCancel(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-container">
                <el-pagination
                        class="pagiantion"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-size="pagination.pageSize"
                        layout="total, prev, pager, next, jumper"
                        :total="pagination.total">
                </el-pagination>
            </div>
        </div>
    </div>

</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>

<script>
    /*export default {
        methods: {
            handleCommand(command) {
                window.alert('click on item ' + command);
            }
        }
    }*/
    var vue = new Vue({
        el: '#app',
        data: {
            activeName: 'first',//添加/编辑窗口Tab标签名称
            pagination: {//分页相关模型数据
                currentPage: 1,//当前页码
                pageSize: 10,//每页显示的记录数
                total: 0,//总记录数
                queryString: null//查询条件
            },
            dataList: [],//当前页要展示的分页列表数据
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.pagination.currentPage = 1;
            this.findPage();//页面初始化完成后后就要执行分页方法
        },
        methods: {
            //条件查询
            findillness() {
                this.pagination.currentPage = 1;
                this.findPage();
            },
            //删除病例信息
            handleCancel(row) {
                if (confirm("确定删除该项吗?")) {
                    axios.get("/category/delectByIllnessIdAndMemberId.do?id=" + row.id + "&memberId=" + row.memberId).then((res) => {
                        if (res.data.flag) {
                            this.$message({
                                type: 'success',
                                message: res.data.message,
                            });
                            this.findPage();
                        } else {
                            this.$message(res.data.message)
                        }
                    })
                }
            },
            //分页查询
            findPage() {
                //发送ajax请求，提交分页相关参数(当前页码、每页显示条数、查询条件)
                var param = {
                    currentPage: this.pagination.currentPage,
                    pageSize: this.pagination.pageSize,
                    queryString: this.pagination.queryString
                };
                var _this = this;
                axios.post("/category/findIllnessMember.do", param).then((res) => {
                    _this.dataList = res.data.rows;
                    _this.pagination.total = res.data.total;

                })
            },

            //切换页码
            handleCurrentChange(currentPage) {
                //重新设置最新的页码
                this.pagination.currentPage = currentPage;
                //调用findPage方法重新进行分页查询
                this.findPage();
            },
            /*//下拉框
            handleCommand(command) {
                this.pagination.currentPage = 1;
                this.pagination.queryString = command;
                this.findPage();
            },*/
        },
    })
</script>
</html>